﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Confucius.entity
{
    /// <summary>
    /// Author:Liangchuan Gu
    /// date:2012-04-08
    /// </summary>
    public class ObjectTriggerIndex
    {
        private string conditionType;

        public string ConditionType
        {
            get { return conditionType; }
            set { conditionType = value; }
        }

        private string gameObjectID;

        public string GameObjectID
        {
            get { return gameObjectID; }
            set { gameObjectID = value; }
        }

        public ObjectTriggerIndex(String gameObjectID, String conditionType)
        {
            this.conditionType = conditionType;
            this.gameObjectID = gameObjectID;
        }

        public override Boolean Equals(Object o)
        {
            if (o == null)
            {
                return false;
            }
            if (o == this)
            {
                return true;
            }
            if (o is ObjectTriggerIndex)
            {
                ObjectTriggerIndex other = (ObjectTriggerIndex)o;
                if (other.ConditionType.Equals(conditionType)
                        && other.GameObjectID.Equals(gameObjectID))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }


        public override int GetHashCode()
        {
            int hash = 7;
            hash = 31 * hash + conditionType.GetHashCode();// Potential issues
            hash = 31 * hash + gameObjectID.GetHashCode();
            return hash;

        }

    }
}
